home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
basic
/
ace_ftp.lha
/
ACE_FTP
/
docs
/
achat.doc
next >
Wrap
Text File
|
1999-04-14
|
19KB
|
586 lines
-----------------------------8<------------------------------
__ __ __ __ __ _____
/ \ / \ / \ / \ | | / \ |
|__| | |_ | |__| |__| |
| | | | | | | | | |
| | \__/ \__/ \__/ | | | | |
(ACE Conversations, Hints, And Tips)
Introduction
~~~~~~~~~~~~
This file is an attempt by myself and David Benn to gather together
in one place as much as possible of the interaction taking place between
ACE users. At the moment the format is very informal, but that may
change in the future. The various entries have been grouped together
under the broad headings of:
General Info (not directly related to code)
Help! (various Q&A's dealing with specific code problems)
Optimization Tips (David's long awaited optimization guide! :)
This format is very much subject to change, and it is the hope of
both David and myself that ACE users will send in many more entries. As
the file grows, the format will evolve.
Please send your submissions to this file to the ACE list, with a
subject containing 'ACE CHAT submission' or something similar.
Rich Allen
rico@wsnet.com
I'd just like to add a vote of thanks to Rich for putting this material
together from ACE list archives and some messages I sent him. Credit also
goes to him for dreaming up the name "ACHAT" :).
It was my initial suggestion that led to Rich starting work on an ACE FAQ,
but as he rightly pointed out to me recently, a FAQ is less appropriate
than what you now see before you.
ACHAT seems to be the natural place for my ACE source-level optimisation
guide, and I will add more to the Optimisation Tips section of this
document as time goes by.
Let me repeat Rich's exhortation for input from other ACE list members.
The problem with the list is that unless archived, we can lose the distilled
wisdom of its members. This project is an effort to prevent that.
Enjoy.
David Benn
D.Benn@appcomp.utas.edu.au
General Info
~~~~~~~~~~~~
1) Where can I get ACE?
2) Where are the FDs?
3) How can I print ace.doc easily?
1) Where can I get the latest version of ACE?
You can get it from:
Aminet sites in dev/basic
or
ftp.appcomp.utas.edu.au in /pub/ACE/dist
The latter is David Benn's local FTP site and has little traffic.
You might also want to try the ACE WWW page if you have access to a
web browser. The URL is:
http://www.appcomp.utas.edu.au/users/dbenn/
****
2) Where can I get the FDs for the most common libraries?
You can obtain the FDs by anonymous FTP from:
ftp.dfv.rwth-aachen.de (/cdrom/bbs/cbm)
You need the file:
nduk-vNN.lha
where NN is the version number of your Amiga's OS. Use the VERSION command
from the shell to determine this (eg. Wb 2.04 is version 37, Wb 3.0 is
version 39 and Wb 3.1 is version 40). This will give you includes, FDs etc.
Also (from Bill Maddock):
You can get the .fd files for versions 37, 38, 39 & 40 of the OS from the
fresh fish CD-ROM volume 7 (or someone who has it with THEIR cd-rom drive)
or you can get the version 34 .fd files off of a workbench extras 1.3 disk.
Not very adequate, I know, but if you're not doing version-specific stuff,
they should suffice.
****
3) How can I print ace.doc easily (page-wise).
Compile and run ACE:utils/pager/pager.b specifying ace.doc as the file to
be printed when prompted on the command line.
****
HELP! (Q&A's)
~~~~~~~~~~~~~
1) Array trouble
2) Default string size
3) Event handling
4) Modifying slider gadgets
5) SLEEP and INKEY$ from the CLI/SHELL
6) Reading special keys (eg. shift, ctrl, arrow keys, F1..F10)
7) Software reboot
8) Window titlebar
9) C structures vs ACE structures.
1) I DIMensioned a string array using the SIZE option. When the array is
filled with strings of the size I specified in the DIM statement, I get weird
results. Why aren't the array elements storing my strings?
It sounds as if the terminating null character is getting over-written.
Each element in a string array ends with ASCII 0. This means that you
must specifiy a SIZE value that is at least one greater than the maximum
string length you are storing in the array. For example, an array of
strings in which the maximum length of string will be eight must have a
SIZE parameter of at least NINE.
****
2) I have a small program that reads in a file and sends it to the printer
device. The program worked perfectly in AmigaBASIC but after compiling it
with ACE I get a visit from the GURU. Here's the code that is causing the
problem:
OPEN "O",2,"prt:"
OPEN "I",1,"app.form"
a$=INPUT$(LOF(1),1)
PRINT #2,a$
END
If the file you are opening is larger than 1024 bytes (the default string
size) then you are attempting to put more information than can fit into a$.
You may either set the string size of a$ to a larger value, eg.
STRING a$ SIZE 32768
to get a 32K string, or you can dynamically allocate it at run-time:
buffer = ALLOC(LOF(1)+1) '..file size + 1 for null-terminator
IF buffer = 0& THEN STOP
STRING a$ ADDRESS buffer
Is your file longer than 32K? If so, then that's the answer. As
documented in ref.doc under INPUT$, the buffer for INPUT$ is currently
32K. If you want to handle bigger files, allocate a buffer with ALLOC
and read the file with xRead, so the above code becomes:
DECLARE FUNCTION xRead& LIBRARY
DECLARE FUNCTION xWrite LIBRARY
OPEN "O",2,"prt:"
OPEN "I",1,"app.form"
ADDRESS buffer
buffer = ALLOC(LOF(1)) : IF buffer = 0& THEN cleanup
length = xRead(HANDLE(1),buffer,LOF(1))
IF length > 0 THEN xWrite(HANDLE(1),buffer,length)
cleanup:
CLOSE 1,2
END
****
3) What's the deal with changing the status of trapping for a particular
event?
In ACE, <event> ON | STOP | OFF must be used AT THE PLACE IN THE CODE
WHERE THE EFFECT IS DESIRED. You have to think of these ON|OFF|STOP
commands as compiler directives.
This means that you can't expect to do the following:
GOSUB change_break_status
WHILE 1
PRINT "Gee I hope ctrl-c works here!"
WEND
change_break_status:
ON BREAK GOTO quit
BREAK ON
quit:
PRINT "***break!"
END
This won't work and your program will loop forever. The following _will_
work however:
ON BREAK GOTO quit
BREAK ON
WHILE 1
PRINT "Gee I hope ctrl-c works here!"
WEND
quit:
PRINT "***break!"
END
****
4) Is it possible to change the value in a slider gadget after it has
been created?
Yes, there is a way to do this. You can use GADGET MOD for this purpose
(I assume you are using ACE v2.3 or higher?).
The syntax is: GADGET MOD id,knob-position[,max-position]
So, one can say something like:
GADGET 1,ON,10,(50,50)-(100,60),POTX
GADGET MOD 1,5
which would create a horiz. slider and then change the knob position to 5.
As the syntax indicates one can also change the number of knob positions
(and hence the size of the knob).
See ref.doc for further details under GADGET MOD and also
ACE:prgs/GUI/ACEgadgets.b for an example of where this is used (click on
the "Move" button).
****
5) If I do not open a new window or screen from the ACE program, the
INKEY$ function seems not to work flawlessly for me. My mistake, but
I would like to learn why. I have set up a WHILE..WEND loop, like the
following:
WHILE lastkey$<>""
SLEEP
lastkey$=inkey$
WEND
IF lastkey$="A" THEN GOTO ENDPROGRAM
IF lastkey$="L" THEN '.... whatever follows
Well, I press "A" the